export const addRules = {
  btnCode: [
    {
      required: true,
      message: '请输入按钮编号',
      trigger: 'blur'
    }
  ],
  btnName: [
    {
      required: true,
      message: '请输入按钮名称',
      trigger: 'blur'
    }
  ],
  name: [
    {
      required: true,
      message: '请输入菜单名称',
      trigger: 'blur'
    }
  ],
  title: [
    {
      required: true,
      message: '请输入菜单标题',
      trigger: 'blur'
    }
  ],
  component: [
    {
      required: true,
      message: '请输入组件',
      trigger: 'blur'
    }
  ],
  path: [
    {
      required: true,
      message: '请输入菜单URL',
      trigger: 'blur'
    }
  ],
  icon: [
    {
      required: true,
      message: '请输入icon',
      trigger: 'blur'
    }
  ],
  menuCode: [
    {
      required: true,
      message: '请输入编号',
      trigger: 'blur'
    }
  ],
  menuSort: [
    {
      required: true,
      message: '请输入排序',
      trigger: 'blur'
    }
  ],
  appId: [
    {
      type: 'number',
      required: true,
      message: '请选择所属应用',
      trigger: 'change'
    }
  ],
  isFrame: [
    {
      type: 'number',
      required: true,
      message: '请选择是否外链',
      trigger: 'change'
    }
  ],
  isWhite: [
    {
      type: 'number',
      required: true,
      message: '请选择是否白名单',
      trigger: 'change'
    }
  ],
  hidden: [
    {
      type: 'number',
      required: true,
      message: '请选择是否隐藏',
      trigger: 'change'
    }
  ],
  cache: [
    {
      type: 'number',
      required: true,
      message: '请选择是否缓存',
      trigger: 'change'
    }
  ],
  enabled: [
    {
      type: 'number',
      required: true,
      message: '请选择是否可用',
      trigger: 'change'
    }
  ]
};

export const tableColumns = [
  {
    title: '标题',
    dataIndex: 'title',
    width: '220px'
  },
  {
    title: '名称',
    dataIndex: 'name'
  },
  {
    title: '组件',
    dataIndex: 'component'
  },
  {
    title: '路径',
    dataIndex: 'path'
  },
  {
    title: '重定向路径',
    dataIndex: 'redirect'
  },
  {
    title: '图标',
    dataIndex: 'icon'
  },
  {
    title: '显示顺序',
    dataIndex: 'menuSort'
  },
  {
    title: '是否可用',
    dataIndex: 'enabled',
    customRender: (row) => {
      if (row.record.enabled) {
        return '是'
      } else {
        return '否'
      }
    }
  },
  {
    title: '更新时间',
    ellipsis: true,
    dataIndex: 'updateTime',
    width: '160px'
  },
  {
    title: '操作栏',
    key: 'operation',
    align: 'center',
    fixed: 'right',
    slots: {
      customRender: 'operation'
    },
    width: '160px'
  }
]